package com.dyh.quickdemo.bizDemo.PlatformSplit;

import com.alibaba.fastjson.JSON;

import java.util.*;

/*
@Author=Joey Wheeler
@Date=2020/11/26 10:47
*/
public class M2 {

    private Map<String,Integer> item2groupIndx = new HashMap<>();
    private int incrGroupIndx = 1;
    private M2(){}
    public static M2 init(){
        return new M2();
    }
    public  M2 bundle(String... eles){
        for (String ele : eles) {
            item2groupIndx.put(ele,incrGroupIndx);
        }
        incrGroupIndx++;
        return this;
    }
    public Map<String,Integer> group(){
        item2groupIndx.put("FALLBACK",0);
        return this.item2groupIndx;
    }

    public static void main(String[] args) {
        Map<String,Integer> res = M2.init()
                .bundle("TAOBAO")
                .bundle("PINDUODUO")
                .bundle("ALIBABA","DYH").group();

        System.out.println(JSON.toJSONString(res));
    }
}
